var app = new Vue({
    el: '#loginBox',
    data: {
        account: {
            username: '',
            pwd: ''
        }
    },
    methods: {
        login: function () {
            let that = this;
            axios.post("/demo/login", that.account).then(
                function (res) {
                    let status = res.status;
                    if (status === 200) {
                        let data = res.data;
                        if (data === 200) {
                            that.$message.success('登陆成功!');
                            location.href = './html/num.html';
                        } else if (data === 10001) {
                            that.$message.warning('用户名和密码不能为空!');
                        } else if (data === 10002) {
                            that.$message.error('用户名或密码输入错误!');
                        }
                    } else {
                        console.log(res);
                    }
                    that.account = {
                        username: '',
                        pwd: ''
                    }
                }, function (err) {
                    console.log(err);
                }
            )
        }
    }
})